<?php
if (!defined('CMS_SYSTEM')) header("Location: index.php");

if(file_exists(DATAFOLD."/config_products.php")) {
	require(DATAFOLD."/config_products.php");
}

global $db, $prefix, $currentlang, $module_name, $path_upload, $id;
$content="";

$result_lastproduct = $db->sql_query("SELECT id, title, images FROM ".$prefix."_products WHERE  active='1'  AND alanguage='$currentlang' AND pbestbuy='1' ORDER BY time DESC LIMIT 6");
$numrows = $db->sql_numrows($result_lastproduct);
if($numrows > 0) {
	$a=0;
$content .= "<div class=\"div-block\">";
$content .= "<div class=\"div-tblock\">"._SAN_PHAM_BAN_CHAY."</div>";
$content.="<div class=\"div-tblock-table\">";
$content .= "<marquee style=\"text-align:center\" width=\"174\" height=\"350\" onmouseover=\"stop()\" onmouseout=\"start()\" direction=\"up\" behavior=\"scroll\" scrollAmount=\"2\">";
	
	while(list($idlast, $titlelast, $imageslast) = $db->sql_fetchrow($result_lastproduct)) {
		
		//$get_path = get_path($time);
		//$path_upload_img = "$path_upload/news/$get_path";
		$a++;
		if( $imageslast !="") {
			
			$imageslast = "thumb_".$imageslast;
			$content .= "<p><img border=\"0\" src=\"".$path_upload."/products/".$imageslast."\" width=\"100\">";
			$content .= "</p><strong><span style='text-transform:uppercase;color:#000';text-align:center;><a href=\"".url_sid("index.php?f=news&do=detail&id=$idlast")."\" class=\"newsothers\">$titlelast</a></span></strong><br/><br/>";
		} else {
			$content .= "<p><a href=\"".url_sid("index.php?f=news&do=detail&id=$idlast")."\" class=\"newsothers\">$titlelast</a></p><br/><br/>";
		}
		
	}
	
$content .= "</marquee>";
$content.="</div>";
$content .= "</div>";
}

?>

